<template>
  <div class="hello">


  </div>
</template>

<script>
  import marked from 'marked'
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App lyh'
    }
  },
  mounted() {
    var rendererMD = new marked.Renderer();
        marked.setOptions({
          renderer: rendererMD,
          gfm: true,
          tables: true,
          breaks: false,
          pedantic: false,
          sanitize: false,
          smartLists: true,
          smartypants: false
        });//基本设置
        console.log(marked('<div>nihao <p>世界</p></div>'));
        
        
        var tokens = marked.lexer('text');//把text解析为一个marked.js的内部对象
            console.log(marked.parser(tokens));//又把这个对象转化为html字符串。（<p>text</p>）
        
            var lexer = new marked.Lexer({sanitize: true});//放option信息
            var tokens = lexer.lex('<h1>hello</h1>');//<p>&lt;h1&gt;hello&lt;/h1&gt;</p>
            console.log(marked.parser(tokens));
            console.log(lexer.rules);//打出正则信息
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
